import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";

export type UserResult = {
  code: any;
  success: boolean;
  data: {
    [x: string]: any;
    avatar: string;
    username: string;
    nickname: string;
    roles: Array<string>;
    permissions: Array<string>;
    accessToken: string;
    refreshToken: string;
    expires: Date;
  };
};
// type allCustomerResult = {
//   success: boolean;
//   data?: Array<any>;
// };
type allUserResult = {
  success: boolean;
  data: {
    records: Array<any>;
    total: number;
    size: number;
    current: number;
    pages: number;
  };
};

type addCustomerResult = {
  code: any;
  success: boolean;
  data?: Array<any>;
};

// 默认进来查找所有的卡号
export const getAllCardList = (data?: object) => {
  return http.request<allUserResult>("post", baseUrlApi("card/list "), {
    data
  });
};

// 添加卡号
export const addCard = (data?: object) => {
  return http.request<addCustomerResult>("post", baseUrlApi("card/add"), {
    data
  });
};
